# handler.py
from django.core.files.uploadhandler import *
from django.core.files.uploadedfile import *


class myFileUploadHandler(TemporaryFileUploadHandler):
    def __init__(self, request=None):
        super().__init__(request)
        self.file = None

    def new_file(self, *args, **kwargs):
        super().new_file(*args, **kwargs)
        print('new_file')
        self.file = TemporaryUploadedFile(self.file_name,
                                          self.content_type,
                                          0,
                                          self.charset,
                                          self.content_type_extra)
